﻿using Movies.GraphQL.Client.Services;
using Movies.Models.Models;
using Movies.Models.Models.Enums;

var service = new MovieService();

var sub = service.SubscriptionMovieAdd();

sub.Subscribe(response =>
{
    Console.WriteLine($"Sub - Movie Added: {response.Data.Movie.Id} - {response.Data.Movie.Name}");


});


var movie = await service.GetMovie(1);

Console.WriteLine($"Movie: {movie.Name} - {movie.Description}");


var movies = await service.GetMovies();
Console.WriteLine($"Total of movies:{movies.Count}");


var newMovie = new Movie { Name = "Ice name", Description = "hello ice age", LaunchDate = DateTime.Now, Genre = MovieGenre.Action };

var addedMovie = await service.AddMovie(newMovie);
Console.WriteLine($"Movie added - Id:{addedMovie.Id}");


var updatedMovieId = 1;
var updateMovie = new Movie { Name = "Ice name 2", Description = "hello ice age", LaunchDate = DateTime.Now, Genre = MovieGenre.Action };

var updatedMovie = await service.UpdateMovie(updatedMovieId, updateMovie);
Console.WriteLine($"Movie added - Id:{updatedMovie.Id}");


var movieId = 1014;
bool deleted = await service.DeleteMovie(movieId);
Console.WriteLine($"Movie deleted {movieId}-{deleted}");


Console.ReadLine();